package com.hmy.finance.api.common.enums.receipt;

import lombok.Getter;

/**
 * 账户余额不足以支出时的处理方式
 *
 * @author songkf
 */
@Getter
public enum InsufficientExpensesMethodEnum {
    REFUSE(0, "拒绝"),
    PARTIALLY(1, "部分支出");

    private final Integer code;
    private final String desc;

    InsufficientExpensesMethodEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static InsufficientExpensesMethodEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (InsufficientExpensesMethodEnum type : InsufficientExpensesMethodEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

}
